TES AddItem bug workaround, Or: How to make an ingredients chest
The Elder Scrolls Homepage | HelpSearchMembersCalendar |
Logged in as: Ronin49 ( Log Out ) | My Controls · View New Posts · 0 New Messages |
TES AddItem bug workaround, Or: How to make an ingredients chest
_aragon |
Jan 19 2005, 08:08 AM
Post
#1
|
Novice Joined: 16-January 05 From: Netherlands |
Hi all,
For my TelMagus plugin I had to create a workaround for the dreaded "AddItem" bug in morrowind to make a reliable ingredients chest. Here is the problem: the "AddItem" call can add items to containers. However, if the container has been emptied in game by the player, the "AddItem" call will no longer work. GhanBuriGhan's guide says that the only fix is to delete the container and place a new one -- but one can not check whether the container was empty or not! The workaround is to attach a script to the container that always adds and removes a dummy item in the same frame that the player activated it. So, my ingredients chest has a script that looks like: ; Open the chest Activate ; Always add and remove a dummy (this hack keeps the "AddItem" calls working) AddItem, "misc_de_cloth10", 1 RemoveItem, "misc_de_cloth10", 1 Furthermore, we make the chest with "references persist". Now we can reference it from an ingredients sorter using code like: set count to ( player->GetItemCount, "ingred_dreugh_wax_01" ) while ( count > 0 ) set count to ( count - 1 ) player->RemoveItem, "ingred_dreugh_wax_01", 1 "_tm_ingredients_chest"->AddItem, "ingred_dreugh_wax_01", 1 endwhile Ok, have fun with your own ingredients chests, -- Aragon |
_aragon |
Jan 20 2005, 03:24 PM
Post
#2
|
Novice Joined: 16-January 05 From: Netherlands |
A little bump before this great workaround gets forgotten forever :)
|
Nigedo |
Jan 20 2005, 03:35 PM
Post
#3
|
Diviner Joined: 29-May 03 From: Bethamez, Handfast Hall |
Sounds cool, this bug has been the bane of container scripting forever.
Can we see the whole script please Aragon? -------------------- Dean of the Theoretical Whirling School of Vivec
The Whirling School | Academy for Dwemer Studies | ES Lore FAQ Thrown weapons, or the power to mod them! |
PirateLord |
Jan 20 2005, 04:41 PM
Post
#4
|
Disciple Joined: 7-October 03 From: Earth, some of the time |
I just added some gold pieces to my containers, which is fine, since if the players nicks the gold too, it disables the script, which is just perfect :)
Good workaround though. -------------------- Vist my Morrowind Mods page
Piratelords Mods Greater Dwemer Ruins Forum (If I get asked one more time "Is it Compatable with MCA", I'm gonna get so angry that I'll make Dagoth Ur look like a Mud-Crab, grrrrr.....) |
Lo-Fi Version | 0.1692sec
--
9 queries
GZIP Enabled
Time is now: 15th February 2005 - 11:33 PM |
|